`
https://leetcode.cn/problems/find-the-duplicate-number/
`

/**
 * @param {number[]} nums
 * @return {number}
 */
var findDuplicate = function (nums) {
  for (let i = 0; i < nums.length; i++) {
    // 使用负号来标记数字是否出现过
    const num = Math.abs(nums[i])
    if (nums[num] < 0) return num
    nums[num] *= -1
  }
};